package cn.gyouzhe.source.vo;

import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品VO
 *
 * @author wangchuan
 * @datetime 2018/2/12 23:08
 */
@Setter
@Getter
@NoArgsConstructor
@ToString
public class GoodVo {
    /**
     * 是否保存
     */
    private boolean store = false;
    /**
     * 保存的商品ID
     */
    private int storeGoodId;
    /**
     * 商品ID
     */
    private String goodId;
    /**
     * 商品标题
     */
    private String title;
    /**
     * 短标题
     */
    private String shortTitle;
    /**
     * 商品描述
     */
    private String desc;
    /**
     * 商品图片
     */
    private String pic;
    /**
     * 商品原始价格
     */
    private BigDecimal price = BigDecimal.ZERO;
    /**
     * 商品返佣比例
     */
    private BigDecimal commission = BigDecimal.ZERO;
    /**
     * 分类ID
     */
    private int cid;
    /**
     * 是否是天猫商品
     */
    private int tmall = 0;
    /**
     * 销量
     */
    private int sellNum = 0;
    /**
     * 数据库保存ID
     */
    private int storeCouponId;
    /**
     * 券ID
     */
    private String couponId;
    /**
     * 券价格
     */
    private BigDecimal couponPrice = BigDecimal.ZERO;
    /**
     * 券使用条件
     */
    private BigDecimal condition;
    /**
     * 券地址
     */
    private String couponLink;
    /**
     * 券开始时间
     */
    private LocalDateTime couponStartTime;
    /**
     * 券结束时间
     */
    private LocalDateTime couponEndTime;
    /**
     * 数据库保存的卖家ID
     */
    private int storeSellerId;
    /**
     * 卖家ID
     */
    private String sellerId;
    /**
     * 店铺名称
     */
    private String shopName;
    /**
     * 商品创建时间
     */
    private LocalDateTime createTime = LocalDateTime.now();

    private GoodVo(String goodId, String title, String shortTitle, String desc, String pic, BigDecimal price, BigDecimal commission, int cid, int tmall, int sellNum, String couponId, BigDecimal couponPrice, BigDecimal condition, String couponLink, LocalDateTime couponStartTime, LocalDateTime couponEndTime, String sellerId, String shopName) {
        this.goodId = goodId;
        this.title = title;
        this.shortTitle = shortTitle;
        this.desc = desc;
        this.pic = pic;
        this.price = price;
        this.commission = commission;
        this.cid = cid;
        this.tmall = tmall;
        this.sellNum = sellNum;
        this.couponId = couponId;
        this.couponPrice = couponPrice;
        this.condition = condition;
        this.couponLink = couponLink;
        this.couponStartTime = couponStartTime;
        this.couponEndTime = couponEndTime;
        this.sellerId = sellerId;
        this.shopName = shopName;
    }

    public static GoodVo of(String goodId, String title, String shortTitle, String desc, String pic, BigDecimal price, BigDecimal commission, int cid, int tmall, int sellNum, String couponId, BigDecimal couponPrice, BigDecimal condition, String couponLink, LocalDateTime couponStartTime, LocalDateTime couponEndTime, String sellerId, String shopName) {
        return new GoodVo(goodId, title, shortTitle, desc, pic, price, commission, cid, tmall, sellNum, couponId, couponPrice, condition, couponLink, couponStartTime, couponEndTime, sellerId, shopName);
    }
}
